package com.itheima.mapper;

import com.itheima.pojo.Category;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface CategoryMapper {
    @Insert("insert into category values(null,#{type},#{name},#{sort})")
    int insert(Category category);

    @Select("select count(1) from category")
    int selectCount();
    @Select("select * from category limit #{pageIndex} ,#{pageSize}")
    List<Category> selectPage(@Param("pageIndex") int pageIndex, @Param("pageSize")int pageSize);

    @Delete("delete from category where id = #{id}")
    int deleteById(long id);


    @Update("update category set name = #{name},sort=#{sort} where id =#{id} ")
    int updateById(Category category);
}
